home *** CD-ROM | disk | FTP | other *** search
/ Birds of North America / Birds of North America.iso / title.mst < prev    next >
Text File  |  1994-10-14  |  17KB  |  491 lines

  1. '**************************************************************************
  2. '*
  3. '* TITLE.MST - Viewer Runtime Setup Script
  4. '*
  5. '* CUSTOMIZING TITLE.MST
  6. '*
  7. '* For a simple Setup routine, you just need to assign values to the 
  8. '* series of variables following the heading "Setup Variables". This
  9. '* script also provides for the following more-advanced options, which
  10. '* are supported by subroutines located later in this script:
  11. '*
  12. '* Option                                         See Subroutine
  13. '* ------------------------------------------     ---------------------
  14. '* Install more than one .MVB file                ModifyViewerIni
  15. '* Install Help title                             ModifyViewerIni
  16. '* Install custom DLLs                            ModifyViewerIni
  17. '* Install multiple Program Manager items         ModifyProgramManager
  18. '* Display a custom icon with the ProgMan item    ModifyProgramManager
  19. '* Install custom fonts                           RegisterCustomFonts
  20. '* Install Video for Windows runtime files        RegisterDrivers
  21. '*
  22. '* Each customization note starts with the heading CUSTOMIZATION.
  23. '*
  24. '**************************************************************************
  25.     
  26.     '' Global variables
  27.  
  28.     GLOBAL TitleShortName$
  29.     GLOBAL TitleLongName$
  30.     GLOBAL MVBFileName$
  31.     GLOBAL PromptForPath%
  32.     GLOBAL DefaultPath$
  33.     GLOBAL ProgManGroup$
  34.     GLOBAL ProgManItem$
  35.  
  36.     '' ****************************************************************
  37.     '' ** Setup Variables
  38.     '' ****************************************************************
  39.  
  40.     '' Set the following string to a short form of the title name
  41.     '' (for example, "Gallery")
  42.     
  43.     TitleShortName$ = "Birds"
  44.     
  45.     '' Set the following string to a long form of the title name
  46.     '' (for example, "Viewer 2.0 Gallery")
  47.     
  48.     TitleLongName$ = "Birds, Birds, Birds"
  49.         
  50.     '' Set the following variable to the name of the MVB file, without 
  51.     '' the filename extension (for example, "GALLERY")
  52.         
  53.     MVBFileName$ = "MAIN"
  54.         
  55.     '' The following variable determines whether Setup prompts the user
  56.     '' to specify a directory in which to install title files. (Files
  57.     '' to be installed on the hard disk must be listed in the TITLE.INF 
  58.     '' file under the [Installed Title Files] section.) Specify one of
  59.     '' the following values:
  60.     ''
  61.     '' 0    Install title files in the Windows directory (default setting).
  62.     ''      This is an appropriate setting if you have a limited number
  63.     ''      of files to copy (for example, a single custom icon or DLL).
  64.     ''
  65.     '' 1    Display a dialog box to prompt the user for a directory in 
  66.     ''      which to install files
  67.         
  68.     PromptForPath% = 0
  69.         
  70.     '' If you have specified 1 in PromptForPath%, set the following 
  71.     '' variable to the default path that will be displayed in the dialog
  72.     '' box (for example, "C:\GALLERY").
  73.         
  74.     DefaultPath$ = "c:\thayer"
  75.     
  76.     '' Set the following variable to the name of the program manager 
  77.     '' group you would like to create (for example, "Viewer 2.0 Gallery")
  78.         
  79.     ProgManGroup$ = "Thayer Birding Software"
  80.     
  81.     '' Set the following variable to the caption of the program manager 
  82.     '' item for your title (for example, "Gallery")
  83.         
  84.     ProgManItem$ = "Birds Birds Birds"
  85.     
  86.     '***********************************************************************
  87.     '** Mainline
  88.     '***********************************************************************
  89.  
  90.     GLOBAL CUIDLL$
  91.  
  92.     '' Include files
  93.     '$INCLUDE 'setupapi.inc'
  94.     
  95.     '' Custom UI dll
  96.     CUIDLL$ = "mscuistf.dll"
  97.     
  98.     '' Dialog ID's
  99.     CONST DESTPATH      = 1000
  100.     CONST APPHELP       = 2000
  101.     CONST TOOBIG        = 3000
  102.     CONST BADPATH       = 4000
  103.     CONST SUCCESS       = 5000
  104.     
  105.     '' Bitmap ID
  106.     CONST LOGO = 1
  107.     
  108.     '' Functions and subroutines
  109.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  110.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  111.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  112.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  113.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  114.     DECLARE SUB ModifyViewerIni
  115.     DECLARE SUB RegisterCustomFonts
  116.     DECLARE SUB ModifyProgramManager
  117.     DECLARE SUB ShowSuccess
  118.     DECLARE SUB RegisterDrivers
  119.     
  120.     '' The following statement turns size checking off. Set it to scmOnFatal 
  121.     '' to enable size checking, where Setup will compare the disk file size 
  122.     '' with the INF file size and report an error if they are not the same.
  123.     
  124.     i% = SetSizeCheckMode(scmOff)
  125.     
  126.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  127.     '' alter the banner bitmap.
  128.     
  129.     SetTitle "Thayer Birding Software Setup"
  130.     SetBitmap CUIDLL$, LOGO 
  131.     
  132.     '' Read in the INF file.
  133.     
  134.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  135.     
  136.     '' Decide where to put title files
  137.     IF PromptForPath% = 1 THEN
  138.         szTitleDir$ = GetTitleDir(DefaultPath$)
  139.         IF szTitleDir$ = "" THEN
  140.             GOTO QUIT
  141.         ENDIF
  142.     ELSE
  143.         szTitleDir$ = GetWindowsDir()
  144.     ENDIF   
  145.     
  146.     '' Copy files
  147.     IF CopyFiles(szTitleDir$) = 0 THEN
  148.         GOTO QUIT
  149.     ENDIF
  150.  
  151.     '' Create the MVIEWER2.EXE MVB association 
  152.     CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone
  153.  
  154.     '' Register in VIEWER.INI
  155.     ModifyViewerIni
  156.  
  157.     '' Register custom fonts
  158.     RegisterCustomFonts
  159.  
  160.     '' Register drivers
  161.     RegisterDrivers
  162.     
  163.     '' Modify Program Manager
  164.     ModifyProgramManager    
  165.     
  166.     '' Success dialog
  167.     ShowSuccess
  168.     
  169.     '' Now start the title
  170.  
  171. ''unremark this when release on CD!!! - JL 4/13/94
  172.     RUN "notepad.exe " + GetSymbolValue("STF_SRCDIR") + "README.TXT", NOWAIT
  173.  
  174. QUIT:
  175.     
  176.     END
  177.     
  178.  
  179. '*************************************************************************
  180. '** Purpose:
  181. '**     Prompts the user for a path for the title files
  182. '** Arguments:
  183. '**     szDefault$ - default path
  184. '** Returns:
  185. '**     New valid path name, or "" if the user quit.
  186. '*************************************************************************
  187.  
  188. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  189.  
  190.     SetSymbolValue "String", TitleShortName$
  191.     SetSymbolValue "EditTextIn", szDefault$
  192.     SetSymbolValue "EditFocus", "ALL"
  193.  
  194.     GETPATH:
  195.  
  196.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  197.  
  198.     IF sz$ = "CONTINUE" THEN
  199.         szTitleDir$ = GetSymbolValue("EditTextOut")
  200.         IF IsDirWritable(szTitleDir$) = 0 THEN
  201.  
  202.             BADPATH:
  203.  
  204.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  205.             IF sz$ = "REACTIVATE" THEN
  206.                 GOTO BADPATH
  207.             END IF
  208.             UIPop 1
  209.             GOTO GETPATH
  210.         END IF
  211.         UIPop 1
  212.         CreateDir szTitleDir$, cmoNone
  213.  
  214.     ELSEIF sz$ = "REACTIVATE" THEN
  215.         GOTO GETPATH
  216.  
  217.     ELSE
  218.         szTitleDir$ = ""
  219.  
  220.     END IF
  221.  
  222.     GetTitleDir = szTitleDir$
  223.  
  224. END FUNCTION
  225.  
  226.  
  227. '*************************************************************************
  228. '** Purpose:
  229. '**     Copies the files in the INF file
  230. '** Arguments:
  231. '**     szTitleDir$ - destination directory for the title files
  232. '** Returns
  233. '**     1 if files were copied, 0 otherwise
  234. '*************************************************************************
  235.  
  236. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  237.  
  238.     '' Add all system files to the copy list
  239.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  240.     
  241.     '' Add all of the title files to the copy list
  242.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  243.     
  244.     '' Check size
  245.     szExtras$ = "Extra"
  246.     szCosts$ = "Costs"
  247.     szNeededs$ = "Neededs"
  248.     FOR i% = 1 TO 26 STEP 1
  249.         AddListItem szExtras$, "0"
  250.     NEXT i%
  251.     
  252.     '' We assume that VIEWER.INI will take another 4K
  253.         ReplaceListItem szExtras$, ASC(MID$(UCASE$(GetWindowsDir()), 1, 1)) - ASC("A") + 1, STR$(4096)
  254.     '' Original Line - ReplaceListItem szExtras$, ASC(MID$(GetWindowsDir(), 1, 1)) - ASC("A") + 1, STR$(4096)
  255.     
  256.     '' Get amount of space required
  257.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  258.     
  259.     '' Put up a message if there is not enough space
  260.     FOR i% = 1 TO 26 STEP 1
  261.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  262.     
  263.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  264.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  265.     
  266.             TOOBIG:
  267.     
  268.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc"